R package preparation

#install packages
library(ahpsurvey)
library(dplyr)
library(kableExtra)
library(ggplot2)

Data inputs

Expert responses (raw data) on General Category

Safety_Ergonomics <- c(-6,-6,-4,-2,1,-9,-9,1,9,-9,-7,-3,-4,-2,-7)
Safety_Functionality <- c(-3,1,-6,1,-4,-9,-9,1,6,-9,-6,-5,7,-3,-7)
Safety_Interfaces <- c(-8,-5,-4,-2,-6,-9,-9,1,9,-9,-9,-5,8,-3,-7)
Ergonomics_Functionality  <- c(3,2,-5,2,-4,-3,5,1,9,3,3,-2,8,-2,5)
Ergonomics_Interfaces <- c(-4,-4,3,2,-6,4,4,1,9,1,-4,-4,8,-3,5)
Functionality_Interfaces <- c(-7,-6,5,1,-6,9,-3,1,1,1,-6,-2,1,1,3)



general <- data.frame(Safety_Ergonomics, Safety_Functionality, 
                      Safety_Interfaces, Ergonomics_Functionality, 
                      Ergonomics_Interfaces,Functionality_Interfaces)

colnames(general) <- c("Safety - Ergonomics" , 
                       "Safety - Functionality",
                       "Safety - Interfaces" , 
                       "Ergonomics - Functionality",
                       "Ergonomics - Interfaces", 
                       "Functionality - Interfaces")

rownames(general) <-  c("Expert #1", "Expert #2" , "Expert #3","Expert #4",
                        "Expert #6", "Expert #8" , "Expert #10", "Expert #11",
                        "Expert #12","Expert #13", "Expert #14", "Expert #15",
                        "Expert #17",  "Expert #19", "Expert #20")

general
##            Safety - Ergonomics Safety - Functionality Safety - Interfaces
## Expert #1                   -6                     -3                  -8
## Expert #2                   -6                      1                  -5
## Expert #3                   -4                     -6                  -4
## Expert #4                   -2                      1                  -2
## Expert #6                    1                     -4                  -6
## Expert #8                   -9                     -9                  -9
## Expert #10                  -9                     -9                  -9
## Expert #11                   1                      1                   1
## Expert #12                   9                      6                   9
## Expert #13                  -9                     -9                  -9
## Expert #14                  -7                     -6                  -9
## Expert #15                  -3                     -5                  -5
## Expert #17                  -4                      7                   8
## Expert #19                  -2                     -3                  -3
## Expert #20                  -7                     -7                  -7
##            Ergonomics - Functionality Ergonomics - Interfaces
## Expert #1                           3                      -4
## Expert #2                           2                      -4
## Expert #3                          -5                       3
## Expert #4                           2                       2
## Expert #6                          -4                      -6
## Expert #8                          -3                       4
## Expert #10                          5                       4
## Expert #11                          1                       1
## Expert #12                          9                       9
## Expert #13                          3                       1
## Expert #14                          3                      -4
## Expert #15                         -2                      -4
## Expert #17                          8                       8
## Expert #19                         -2                      -3
## Expert #20                          5                       5
##            Functionality - Interfaces
## Expert #1                          -7
## Expert #2                          -6
## Expert #3                           5
## Expert #4                           1
## Expert #6                          -6
## Expert #8                           9
## Expert #10                         -3
## Expert #11                          1
## Expert #12                          1
## Expert #13                          1
## Expert #14                         -6
## Expert #15                         -2
## Expert #17                          1
## Expert #19                          1
## Expert #20                          3

Expert responses (raw data) on Safety Category

MotionPlanning_RobotSystems <- c(4,3,-4,-2,1,4,5,1,3,1,-4,-3,-6,1,5)
Motionplanning_OrganizationalMeasures <- c(4,1,-2,4,-4,-4,-5,9,-7,1,-4,-2,-4,-3,-5)
RobotSystems_OrganizationalMeasures <- c(1,-3,3,4,-4,4,-8,9,-7,1,1,4,6,-3,-7)

safety <- data.frame(MotionPlanning_RobotSystems, 
                      Motionplanning_OrganizationalMeasures, 
                      RobotSystems_OrganizationalMeasures)

colnames(safety) <- c("Motion planning - Robot systems", 
                       "Motion planning - Organizational measures",
                       "Robot systems - Organizational measures")

rownames(safety) <- c("Expert #1", "Expert #2" , "Expert #3","Expert #4",
                        "Expert #6", "Expert #8" , "Expert #10", "Expert #11",
                        "Expert #12","Expert #13", "Expert #14", "Expert #15",
                        "Expert #17",  "Expert #19", "Expert #20")

safety
##            Motion planning - Robot systems
## Expert #1                                4
## Expert #2                                3
## Expert #3                               -4
## Expert #4                               -2
## Expert #6                                1
## Expert #8                                4
## Expert #10                               5
## Expert #11                               1
## Expert #12                               3
## Expert #13                               1
## Expert #14                              -4
## Expert #15                              -3
## Expert #17                              -6
## Expert #19                               1
## Expert #20                               5
##            Motion planning - Organizational measures
## Expert #1                                          4
## Expert #2                                          1
## Expert #3                                         -2
## Expert #4                                          4
## Expert #6                                         -4
## Expert #8                                         -4
## Expert #10                                        -5
## Expert #11                                         9
## Expert #12                                        -7
## Expert #13                                         1
## Expert #14                                        -4
## Expert #15                                        -2
## Expert #17                                        -4
## Expert #19                                        -3
## Expert #20                                        -5
##            Robot systems - Organizational measures
## Expert #1                                        1
## Expert #2                                       -3
## Expert #3                                        3
## Expert #4                                        4
## Expert #6                                       -4
## Expert #8                                        4
## Expert #10                                      -8
## Expert #11                                       9
## Expert #12                                      -7
## Expert #13                                       1
## Expert #14                                       1
## Expert #15                                       4
## Expert #17                                       6
## Expert #19                                      -3
## Expert #20                                      -7

Expert responses (raw data) on ERGONOMICS Category

PhysicalErgonomics_CognitiveErgonomics <- c(-3,1,1,1,1,1,1,-5,9,-3,-5,4,8,3,7)


ergonomics <- data.frame(PhysicalErgonomics_CognitiveErgonomics)

colnames(ergonomics) <- c("Physical ergonomics - Cognitive ergonomics")

rownames(ergonomics) <- c("Expert #1", "Expert #2" , "Expert #3","Expert #4",
                        "Expert #6", "Expert #8" , "Expert #10", "Expert #11",
                        "Expert #12","Expert #13", "Expert #14", "Expert #15",
                        "Expert #17",  "Expert #19", "Expert #20")

ergonomics
##            Physical ergonomics - Cognitive ergonomics
## Expert #1                                          -3
## Expert #2                                           1
## Expert #3                                           1
## Expert #4                                           1
## Expert #6                                           1
## Expert #8                                           1
## Expert #10                                          1
## Expert #11                                         -5
## Expert #12                                          9
## Expert #13                                         -3
## Expert #14                                         -5
## Expert #15                                          4
## Expert #17                                          8
## Expert #19                                          3
## Expert #20                                          7

Expert responses (raw data) on FUNCTIONALITY Category

System_Information <- c(-4,1,2,2,1,-3,-3,1,-6,3,-4,-2,-4,1,-5)
System_Task <- c(1,-3,4,1,-2,-2,-3,1,-6,3,-3,-4,8,1,7)
System_ErrorHandling <- c(-2,3,5,-2,-3,4,5,1,-6,3,1,-3,8,1,5)
System_Assistance <- c(-3,2,3,-2,-3,3,-4,1,-6,-3,-6,-3,6,1,7)
Information_Task <- c(4,-2,2,2,-3,2,3,1,8,-6,2,-4,8,1,3)
Information_ErrorHandling <- c(3,5,4,1,-3,3,5,1,6,1,5,-2,8,1,5)
Information_Assistance <- c(3,1,2,-3,-4,4,-3,1,7,-6,-3,-2,1,1,5)
Task_ErrorHandling <- c(-2,2,3,2,-3,3,5,1,-7,4,4,-3,-8,1,-5)
Task_Assistance <- c(-3,2,-2,-3,-4,2,-3,1,-5,-4,-4,2,-8,1,-5)
ErrorHandling_Assistance <- c(-2,-4,-3,3,1,1,-6,1,-6,-7,-5,-4,-8,1,7)

functionality <- data.frame(System_Information,System_Task,System_ErrorHandling,
                            System_Assistance,Information_Task,Information_ErrorHandling,
                            Information_Assistance,Task_ErrorHandling,Task_Assistance,
                            ErrorHandling_Assistance)

colnames(functionality) <- c("System - Information","System - Task","System - Error handling",
                          "System - Assistance","Information - Task","Information - Error handling",
                          "Information - Assistance","Task - Error handling","Task - Assistance",
                          "Error handling - Assistance")

rownames(functionality) <- c("Expert #1", "Expert #2" , "Expert #3","Expert #4",
                             "Expert #6", "Expert #8" , "Expert #10", "Expert #11",
                             "Expert #12","Expert #13", "Expert #14", "Expert #15",
                             "Expert #17",  "Expert #19", "Expert #20")

functionality
##            System - Information System - Task System - Error handling
## Expert #1                    -4             1                      -2
## Expert #2                     1            -3                       3
## Expert #3                     2             4                       5
## Expert #4                     2             1                      -2
## Expert #6                     1            -2                      -3
## Expert #8                    -3            -2                       4
## Expert #10                   -3            -3                       5
## Expert #11                    1             1                       1
## Expert #12                   -6            -6                      -6
## Expert #13                    3             3                       3
## Expert #14                   -4            -3                       1
## Expert #15                   -2            -4                      -3
## Expert #17                   -4             8                       8
## Expert #19                    1             1                       1
## Expert #20                   -5             7                       5
##            System - Assistance Information - Task Information - Error handling
## Expert #1                   -3                  4                            3
## Expert #2                    2                 -2                            5
## Expert #3                    3                  2                            4
## Expert #4                   -2                  2                            1
## Expert #6                   -3                 -3                           -3
## Expert #8                    3                  2                            3
## Expert #10                  -4                  3                            5
## Expert #11                   1                  1                            1
## Expert #12                  -6                  8                            6
## Expert #13                  -3                 -6                            1
## Expert #14                  -6                  2                            5
## Expert #15                  -3                 -4                           -2
## Expert #17                   6                  8                            8
## Expert #19                   1                  1                            1
## Expert #20                   7                  3                            5
##            Information - Assistance Task - Error handling Task - Assistance
## Expert #1                         3                    -2                -3
## Expert #2                         1                     2                 2
## Expert #3                         2                     3                -2
## Expert #4                        -3                     2                -3
## Expert #6                        -4                    -3                -4
## Expert #8                         4                     3                 2
## Expert #10                       -3                     5                -3
## Expert #11                        1                     1                 1
## Expert #12                        7                    -7                -5
## Expert #13                       -6                     4                -4
## Expert #14                       -3                     4                -4
## Expert #15                       -2                    -3                 2
## Expert #17                        1                    -8                -8
## Expert #19                        1                     1                 1
## Expert #20                        5                    -5                -5
##            Error handling - Assistance
## Expert #1                           -2
## Expert #2                           -4
## Expert #3                           -3
## Expert #4                            3
## Expert #6                            1
## Expert #8                            1
## Expert #10                          -6
## Expert #11                           1
## Expert #12                          -6
## Expert #13                          -7
## Expert #14                          -5
## Expert #15                          -4
## Expert #17                          -8
## Expert #19                           1
## Expert #20                           7

Expert responses (raw data) on INTERFACES Category

Visual_Voice <- c(-7,4,-3,1,1,-5,3,1,-9,-5,-8,-2,2,-3,-7)
Visual_Haptics <- c(-4,2,-6,1,1,-2,-4,1,-9,-5,-5,-5,-8,-2,1)
Visual_Gesture <- c(-3,7,-4,1,1,-2,-5,1,-9,-5,-3,-5,-8,1,-5)
Voice_Haptics <- c(3,-4,-3,1,1,1,-4,1,7,4,5,-5,-9,1,1)
Voice_Gesture <- c(2,2,2,1,1,1,-4,1,7,-4,7,-4,-9,1,-5)
Haptics_Gesture <- c(-2,6,4,1,1,1,-4,1,-7,-2,2,4,9,1,-3)


interfaces <- data.frame(Visual_Voice,Visual_Haptics,Visual_Gesture,
                            Voice_Haptics,Voice_Gesture,Haptics_Gesture)

colnames(interfaces) <- c("Visual - Voice","Visual - Haptics",
                             "Visual - Gesture","Voice - Haptics",
                             "Voice - Gesture","Haptics - Gesture")

rownames(interfaces) <- c("Expert #1", "Expert #2" , "Expert #3","Expert #4",
                        "Expert #6", "Expert #8" , "Expert #10", "Expert #11",
                        "Expert #12","Expert #13", "Expert #14", "Expert #15",
                        "Expert #17",  "Expert #19", "Expert #20")
interfaces
##            Visual - Voice Visual - Haptics Visual - Gesture Voice - Haptics
## Expert #1              -7               -4               -3               3
## Expert #2               4                2                7              -4
## Expert #3              -3               -6               -4              -3
## Expert #4               1                1                1               1
## Expert #6               1                1                1               1
## Expert #8              -5               -2               -2               1
## Expert #10              3               -4               -5              -4
## Expert #11              1                1                1               1
## Expert #12             -9               -9               -9               7
## Expert #13             -5               -5               -5               4
## Expert #14             -8               -5               -3               5
## Expert #15             -2               -5               -5              -5
## Expert #17              2               -8               -8              -9
## Expert #19             -3               -2                1               1
## Expert #20             -7                1               -5               1
##            Voice - Gesture Haptics - Gesture
## Expert #1                2                -2
## Expert #2                2                 6
## Expert #3                2                 4
## Expert #4                1                 1
## Expert #6                1                 1
## Expert #8                1                 1
## Expert #10              -4                -4
## Expert #11               1                 1
## Expert #12               7                -7
## Expert #13              -4                -2
## Expert #14               7                 2
## Expert #15              -4                 4
## Expert #17              -9                 9
## Expert #19               1                 1
## Expert #20              -5                -3

Calculation of aggregated importance weights

Aggregated importance weights on General Category

atts <- c("Safety", "Ergonomics", "Functionality", "Interfaces")

important_weight_general <- general %>%
  ahp.mat(atts = atts, negconvert = TRUE) %>% 
  ahp.missing(atts, round = T, limit = T) %>%
  ahp.aggpref(atts, method = "arithmetic")

general_IW_table <- data.frame(important_weight_general)

colnames(general_IW_table) <- c("General Category")

rownames(general_IW_table) <- c("Safety", "Ergonomics", "Functionality", "Interfaces")

general_IW_table %>% mutate_if(is.numeric, round, digits=3)
##               General Category
## Safety                   0.469
## Ergonomics               0.151
## Functionality            0.207
## Interfaces               0.173

Aggregated importance weights on Safety Category

atts <- c("MotionPlanning", "RobotSystems", "OrganizationalMeasures")

important_weight_safety <- safety %>%
  ahp.mat(atts = atts, negconvert = TRUE) %>% 
    ahp.missing(atts, round = T, limit = T) %>%
  ahp.aggpref(atts, method = "arithmetic")

safety_IW_table <- data.frame(important_weight_safety)

colnames(safety_IW_table) <- c("Safety Category")

rownames(safety_IW_table) <- c("Motion Planning", "Robot Systems", "Organizational Measures")

safety_IW_table %>% mutate_if(is.numeric, round, digits=3)
##                         Safety Category
## Motion Planning                   0.353
## Robot Systems                     0.355
## Organizational Measures           0.291

Aggregated importance weights on ERGONOMICS Category

atts <- c("PhysicalErgonomics", "CognitiveErgonomics")

important_weight_ergonomics <- ergonomics %>%
  ahp.mat(atts = atts, negconvert = TRUE) %>% 
    ahp.missing(atts, round = T, limit = T) %>%
  ahp.aggpref(atts, method = "arithmetic")

ergonomics_IW_table <- data.frame(important_weight_ergonomics)

colnames(ergonomics_IW_table) <- c("Ergonomics Category")

rownames(ergonomics_IW_table) <- c("Physical ergonomics", "Cognitive ergonomics")

ergonomics_IW_table %>% mutate_if(is.numeric, round, digits=3)
##                      Ergonomics Category
## Physical ergonomics                0.464
## Cognitive ergonomics               0.536

Aggregated importance weights on FUNCTIONALITY Category

atts <- c("System", "Information","Task","ErrorHandling","Assistant")

important_weight_functionality <- functionality %>%
  ahp.mat(atts = atts, negconvert = TRUE) %>% 
    ahp.missing(atts, round = T, limit = T) %>%
  ahp.aggpref(atts, method = "arithmetic")

functionality_IW_table <- data.frame(important_weight_functionality)

colnames(functionality_IW_table) <- c("Functionality Category")

rownames(functionality_IW_table) <-c("System", "Information","Task","ErrorHandling","Assistant")

functionality_IW_table %>% mutate_if(is.numeric, round, digits=3)
##               Functionality Category
## System                         0.215
## Information                    0.152
## Task                           0.225
## ErrorHandling                  0.268
## Assistant                      0.140

Aggregated importance weights on INTERFACES Category

atts <- c("Visual", "Voice","Haptics","Gesture")

important_weight_interfaces <- interfaces %>%
  ahp.mat(atts = atts, negconvert = TRUE) %>% 
    ahp.missing(atts, round = T, limit = T) %>%
  ahp.aggpref(atts, method = "arithmetic")

interfaces_IW_table <- data.frame(important_weight_interfaces)

colnames(interfaces_IW_table) <- c("Interfaces Category")

rownames(interfaces_IW_table) <-c("Visual", "Voice","Haptics","Gesture")

interfaces_IW_table %>% mutate_if(is.numeric, round, digits=3)
##         Interfaces Category
## Visual                0.407
## Voice                 0.225
## Haptics               0.173
## Gesture               0.195

Calculation of Consistency ratio

Consistency ratio on General Category

atts <- c("Safety", "Ergonomics", "Functionality", "Interfaces")

filling.general <- general %>%
  ahp.mat(atts, negconvert = TRUE) %>%  
  ahp.missing(atts, round = T, limit = T)

cr_general <- filling.general %>% ahp.cr(atts)


cr.value.general <- round(mean(cr_general),3)
cr.value.general
## [1] 0.104

Consistency ratio on Safety Category

atts <- c("MotionPlanning", "RobotSystems", "OrganizationalMeasures")

filling.safety <- safety %>%
  ahp.mat(atts, negconvert = TRUE) %>%  
  ahp.missing(atts, round = T, limit = T)

cr_safety <- filling.safety %>% ahp.cr(atts)

cr.value.safety <- round(mean(cr_safety),3)
cr.value.safety
## [1] 0.197

Consistency ratio on ERGONOMICS Category

atts <- c("PhysicalErgonomics", "CognitiveErgonomics")

filling.ergonomics <- ergonomics %>%
  ahp.mat(atts, negconvert = TRUE) %>%  
  ahp.missing(atts, round = T, limit = T)

cr_ergonomics <- filling.ergonomics %>% ahp.cr(atts)

cr.value.ergonomics <- round(mean(cr_ergonomics),3)
cr.value.ergonomics
## [1] NaN
#Here, the consistency ratio of this ERGONOMICS category is NaN. This means that there is only one pairwise comparison between "Physical ergonomics" and "Cognitive ergonomics"; therefore, there is no inconsistency in expert responses.

Consistency ratio on FUNCTIONALITY Category

atts <- c("System", "Information","Task","ErrorHandling","Assistant")

filling.functionality <- functionality %>%
  ahp.mat(atts, negconvert = TRUE) %>%  
  ahp.missing(atts, round = T, limit = T)

cr_functionality <- filling.functionality %>% ahp.cr(atts)

cr.value.functionality <- round(mean(cr_functionality),3)
cr.value.functionality
## [1] 0.129

Consistency ratio on INTERFACES Category

atts <- c("Visual", "Voice","Haptics","Gesture")

filling.interfaces <- interfaces %>%
  ahp.mat(atts, negconvert = TRUE) %>%  
  ahp.missing(atts, round = T, limit = T)

cr_interfaces <- filling.interfaces %>% ahp.cr(atts)

cr.value.interfaces <- round(mean(cr_interfaces),3)
cr.value.interfaces
## [1] 0.104

Summary of Consistency Ratios

cr.value <- c(cr.value.general,cr.value.safety,cr.value.ergonomics,cr.value.functionality,cr.value.interfaces)
evaluation.category <- c("General category","Safety","Ergonomics","Functionality","interfaces")
cr.frame <- data.frame(evaluation.category, cr.value)
colnames(cr.frame) <- c("Evaluated categories", "Consistency Ratio")
cr.frame
##   Evaluated categories Consistency Ratio
## 1     General category             0.104
## 2               Safety             0.197
## 3           Ergonomics               NaN
## 4        Functionality             0.129
## 5           interfaces             0.104
#Here, the consistency ratio of this ERGONOMICS category is NaN. This means that there is only one pairwise comparison between "Physical ergonomics" and "Cognitive ergonomics"; therefore, there is no inconsistency in expert responses.